#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main() {
    int n = 0, i = 0, j = 0;
    while (~scanf("%d", &n))
    {
        int x = 0;
        for (i = 2; i <= n; i++)
        {
            int t = 0;
            for (j = 2; j < i; j++)
            {
                if (i % j == 0)
                {
                    t = 1;
                    continue;
                }
            }
            if (t == 0)
            {
                x++;
                printf("%d ", i);
            }
        }
        printf("\n%d", n - x - 1);
    }
    return 0;
}